import { EntitySchema } from '@mikro-orm/core';

export class ImsYzdKpGood {
  id!: number;
  title!: string;
  type!: boolean;
  typeId!: number;
  imglist!: unknown;
  video?: unknown;
  spec!: boolean;
  price!: string;
  linePrice?: string;
  kmkId?: number = 0;
  stock!: number;
  weight!: number;
  no?: string;
  skuInfoList?: unknown;
  sales: number = 0;
  virtualSales: number = 0;
  unit!: string;
  integral: number = 0;
  autoSend: boolean = false;
  sendContent?: unknown;
  content!: unknown;
  state!: boolean;
  uniacid!: number;
  serveType!: boolean;
  servicesArr?: unknown;
  sort: number = 0;
  viewNum: number = 0;
  freightType: number = 1;
  freightId?: number;
  freight?: string;
  isDistribute!: boolean;
  aloneDistribute?: boolean;
  commissionType?: boolean;
  commission1?: string;
  commission2?: string;
  commission3?: string;
  addTime?: string;
  updateTime?: string;
  isParam: boolean = false;
  params?: unknown;
  formId?: number;
}

export const ImsYzdKpGoodSchema = new EntitySchema({
  class: ImsYzdKpGood,
  properties: {
    id: { primary: true, type: 'number' },
    title: { type: 'string', length: 255 },
    type: { type: 'boolean' },
    typeId: { type: 'number', index: 'type_id' },
    imglist: { type: 'unknown', columnType: 'longtext' },
    video: { type: 'unknown', columnType: 'longtext', nullable: true },
    spec: { type: 'boolean' },
    price: { type: 'string', columnType: 'numeric(10,2)' },
    linePrice: { type: 'string', columnType: 'numeric(10,2)', nullable: true },
    kmkId: { type: 'number', nullable: true, default: 0 },
    stock: { type: 'number' },
    weight: { type: 'number' },
    no: { type: 'string', length: 255, nullable: true },
    skuInfoList: {
      type: 'unknown',
      fieldName: 'skuInfoList',
      columnType: 'longtext',
      nullable: true,
    },
    sales: { type: 'number', default: 0 },
    virtualSales: { type: 'number', default: 0 },
    unit: { type: 'string', length: 255 },
    integral: { type: 'number', default: 0 },
    autoSend: { type: 'boolean', default: false },
    sendContent: { type: 'unknown', columnType: 'longtext', nullable: true },
    content: { type: 'unknown', columnType: 'longtext' },
    state: { type: 'boolean', index: 'state' },
    uniacid: { type: 'number', index: 'uniacid' },
    serveType: { type: 'boolean' },
    servicesArr: { type: 'unknown', columnType: 'longtext', nullable: true },
    sort: { type: 'number', default: 0 },
    viewNum: { type: 'number', default: 0 },
    freightType: { type: 'number', default: 1 },
    freightId: { type: 'number', nullable: true },
    freight: { type: 'string', columnType: 'numeric(10,2)', nullable: true },
    isDistribute: { type: 'boolean' },
    aloneDistribute: { type: 'boolean', nullable: true },
    commissionType: { type: 'boolean', nullable: true },
    commission1: {
      type: 'string',
      fieldName: 'commission_1',
      columnType: 'numeric(10,2)',
      nullable: true,
    },
    commission2: {
      type: 'string',
      fieldName: 'commission_2',
      columnType: 'numeric(10,2)',
      nullable: true,
    },
    commission3: {
      type: 'string',
      fieldName: 'commission_3',
      columnType: 'numeric(10,2)',
      nullable: true,
    },
    addTime: { type: 'string', length: 255, nullable: true },
    updateTime: { type: 'string', length: 255, nullable: true },
    isParam: { type: 'boolean', default: false },
    params: { type: 'unknown', columnType: 'longtext', nullable: true },
    formId: { type: 'number', nullable: true },
  },
});
